<template>
  <div
    class="app-container"
    :style="{
      '--theme': $store.getters.themeColor,
      paddingTop: isMyEvent && '12px',
    }"
  >
    <el-tabs
      v-model="tab"
      size="medium"
      @tab-click="tabHandleClick"
      v-if="!isMyEvent"
    >
      <el-tab-pane label="事件查询" name="1"></el-tab-pane>
      <el-tab-pane label="超期事件" name="2"></el-tab-pane>
    </el-tabs>
    <el-form
      label-width="94px"
      :style="{ '--theme': $store.getters.themeColor }"
    >
      <el-row style="display: flex; flex-wrap: wrap" class="select-manage13">
        <el-col :span="8">
          <el-form-item label="事件编号">
            <el-input
              v-model.trim="qryParams.orderId"
              placeholder="请输入"
              clearable
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8" class="clear-icon">
          <el-form-item label="告警时间">
            <el-date-picker
              prefix-icon="el-icon-date"
              :editable="false"
              class="timeClass"
              value-format="yyyy-MM-dd HH:mm:ss"
              :picker-options="pickerOptions"
              @focus="setPickerOptions"
              v-model="qryParams.warnTime"
              type="datetimerange"
              range-separator="至"
              popper-class="warnTime"
              :default-time="['00:00:00', '23:59:59']"
              start-placeholder="开始时间"
              end-placeholder="结束时间"
            >
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="事发区域">
            <el-cascader
              v-model="qryParams.area"
              :options="selectDataSource.areaOptions"
              clearable
              :filterable="true"
              ref="tab1"
              @focus="tabUnfold('tab1')"
              placeholder="请选择"
              :show-all-levels="true"
              :props="{ checkStrictly: true }"
              @expand-change="expandChangeFun"
              @change="changeFun"
            ></el-cascader>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="告警类型">
            <!-- <KeyHighSelect v-model="qryParams.eventType" size="small" :dataList="selectDataSource.eventTypeList" :collapseTags="true" :filterable="true" :multiple="true" :clearable="true" placeholder="请选择" labelName="typeName" valueName="typeValue"></KeyHighSelect> -->
            <el-select
              :popper-append-to-body="false"
              v-model="qryParams.eventType"
              placeholder="请选择"
              collapse-tags
              size="small"
              clearable
              filterable
              multiple
            >
              <el-option
                v-for="(item, index) in selectDataSource.eventTypeList"
                :key="index"
                :value="item.typeValue"
                :label="item.typeName"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="摄像机编号">
            <el-input
              v-model.trim="qryParams.deviceCode"
              placeholder="请输入"
              clearable
            ></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="摄像机名称">
            <el-select
              v-model.trim="qryParams.deviceCode2"
              placeholder="请输入"
              size="small"
              clearable
              filterable
              default-first-option
              remote
              @visible-change="clearDev"
              :remote-method="getDevice"
              no-data-text="无匹配数据"
              @keyup.native="
                qryParams.deviceCode2 = qryParams.deviceCode2.replace(/\s/g, '')
              "
            >
              <el-option
                v-for="(item, index) in selectDataSource.DeviceList"
                :key="index"
                :value="item.deviceCode"
                :label="item.devName"
              >
              </el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <template v-if="!this.showButton">
          <el-col :span="8">
            <el-form-item label="物联设备编号">
              <el-input
                v-model.trim="qryParams.iotDeviceCode"
                placeholder="请输入"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="物联设备名称">
              <el-select
                v-model.trim="qryParams.iotDeviceCode2"
                placeholder="请输入"
                size="small"
                clearable
                filterable
                default-first-option
                remote
                :remote-method="getIotDevice"
                no-data-text="无匹配数据"
              >
                <el-option
                  v-for="(item, index) in selectDataSource.iotDeviceList"
                  :key="index"
                  :value="item.deviceCode"
                  :label="item.deviceName"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事件状态">
              <el-select
                v-model="qryParams.eventState"
                placeholder="请选择"
                collapse-tags
                size="small"
                clearable
                filterable
                multiple
              >
                <el-option
                  v-for="(item, index) in selectDataSource.eventStateList"
                  :key="index"
                  :label="item.dictLabel"
                  :value="item.dictValue"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="重要等级">
              <el-select
                v-model="qryParams.importanceLevel"
                placeholder="请选择"
                size="small"
                clearable
                filterable
              >
                <el-option
                  v-for="(item, index) in selectDataSource.importanceLevelList"
                  :key="index"
                  :label="item.dictLabel"
                  :value="item.dictValue"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="事件标题">
              <el-input
                v-model.trim="qryParams.eventTitle"
                placeholder="请输入"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="告警来源">
              <el-select
                v-model="qryParams.eventSourse"
                placeholder="请选择"
                size="small"
                clearable
                filterable
              >
                <el-option
                  v-for="(item, index) in selectDataSource.eventSourceList"
                  :key="index"
                  :value="item.dictValue"
                  :label="item.dictLabel"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否二次研判">
              <el-select
                v-model="qryParams.isSecondJudge"
                placeholder="请选择"
                size="small"
                clearable
                filterable
              >
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="qryParams.isSecondJudge == '1'">
            <el-form-item label="二次研判结果">
              <el-select
                v-model="qryParams.secondJudgeResult"
                @change="changeSecondJudgeResult"
                placeholder="请选择"
                size="small"
                clearable
              >
                <el-option label="真" value="1"></el-option>
                <el-option label="假" value="0"></el-option>
                <el-option label="算法未分析" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否二次识别">
              <el-select
                v-model="qryParams.isSecondIdentify"
                placeholder="请选择"
                size="small"
                @change="qryParams.secondIdentifyResult = null"
                clearable
                filterable
              >
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="qryParams.isSecondIdentify == '1'">
            <el-form-item label="二次识别结果">
              <el-select
                v-model="qryParams.secondIdentifyResult"
                @change="changeSecondJudgeResult"
                placeholder="请选择"
                size="small"
                clearable
              >
                <el-option label="真" value="1"></el-option>
                <el-option label="假" value="0"></el-option>
                <el-option label="算法未分析" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="摄像机厂家">
              <el-select
                v-model="qryParams.modelId"
                placeholder="请选择"
                clearable
                filterable
              >
                <el-option
                  v-for="(item, index) in selectDataSource.videofactoryList"
                  :key="index"
                  :label="item.dictLabel"
                  :value="item.dictValue"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <!--            <el-form-item label="置信度">-->
            <!--              <el-input class="no-tips" v-model="qryParams.confidenceLevel" placeholder="请输入"-->
            <!--                @input="verifyConfidenceLevel" @keydown.native="channelInputLimit" type="number" clearable></el-input>-->
            <!--            </el-form-item>-->
            <div class="confidenceLevel">
              <el-form-item label="置信度">
                <div
                  class="input-wrapper"
                  :style="
                    checkConfidenceLevel() ? '' : 'border:1px solid #FF6A6C'
                  "
                >
                  <div class="bor">
                    <el-input
                      v-model="qryParams.confidenceLevelMin"
                      @input="
                        verifyConfidenceLevel($event, 'confidenceLevelMin')
                      "
                      placeholder="请输入"
                    ></el-input>
                  </div>
                  <div class="bor zhixindu-select">
                    <el-select v-model="qryParams.minChar">
                      <el-option
                        v-for="item in confidenceLevelSelectData"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </div>
                  <div class="bor center-text">置信度</div>
                  <div class="bor zhixindu-select">
                    <el-select v-model="qryParams.maxChar">
                      <el-option
                        v-for="item in confidenceLevelSelectData"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                      ></el-option>
                    </el-select>
                  </div>
                  <div class="bor bor-none">
                    <el-input
                      v-model="qryParams.confidenceLevelMax"
                      @input="
                        verifyConfidenceLevel($event, 'confidenceLevelMax')
                      "
                      placeholder="请输入"
                    ></el-input>
                  </div>
                  <div
                    class="tips"
                    v-if="!checkConfidenceLevel()"
                    title="“最小值、最大值”需至少填写一项，且最小值需要小于等于最大值"
                  >
                    “最小值、最大值”需至少填写一项，且最小值需要小于等于最大值
                  </div>
                </div>
              </el-form-item>
            </div>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-form-item label="客户名称/ID">
              <el-select
                v-model="tenantkeyword"
                filterable
                remote
                reserve-keyword
                placeholder="请输入"
                :remote-method="searchTenant"
                :loading="loading"
                @change="tenantChange"
                @clear="tenantList = []"
                clearable
              >
                <el-option
                  v-for="(item, index) in tenantList"
                  :key="index"
                  :label="item.tenantName"
                  :value="item.tenantId"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否超期">
              <el-select
                v-model="qryParams.ifTimeOut"
                placeholder="请选择"
                size="small"
                clearable
                filterable
                :disabled="tab === '2'"
              >
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="研判结果">
              <el-select
                v-model="qryParams.judgeResult"
                placeholder="请选择"
                size="small"
                clearable
                filterable
              >
                <el-option label="真警" value="1"></el-option>
                <el-option label="误报" value="0"></el-option>
                <el-option label="重复告警" value="2"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="是否收藏">
              <el-select
                v-model="qryParams.isCollection"
                placeholder="请选择"
                size="small"
                clearable
                filterable
              >
                <el-option label="是" value="1"></el-option>
                <el-option label="否" value="0"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- 租户视角的组织名称 -->
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="组织名称">
              <el-cascader
                :show-all-levels="false"
                v-model="qryParams.orgIds"
                placeholder="请选择"
                ref="tab2"
                @focus="tabUnfold('tab2')"
                collapse-tags
                filterable
                :options="orgTreeData"
                :props="orgTreeProp"
                clearable
                style="width: 100%; font-size: 14px"
              ></el-cascader>
            </el-form-item>
          </el-col>
          <!-- 铁塔视角的组织名称 -->
          <el-col :span="8" v-if="userIdIsShow">
            <el-form-item label="组织名称">
              <el-cascader
                v-model="qryParams.areaIds"
                :show-all-levels="false"
                placeholder="请选择"
                collapse-tags
                filterable
                :options="orgTreeData"
                :props="orgTreeProp"
                clearable
                style="width: 100%; font-size: 14px"
                ref="orgName"
                @change="handleCascaderChange"
              ></el-cascader>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="摄像机标签">
              <KeyHighSelect
                v-model="qryParams.deviceLabelId"
                size="small"
                :dataList="selectDataSource.deviceLabelList"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="labelName"
                valueName="labelId"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警类型标签">
              <KeyHighSelect
                v-model="qryParams.tagIdList"
                size="small"
                :dataList="tagList"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="tagName"
                valueName="tagId"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警标签">
              <KeyHighSelect
                v-model="qryParams.alarmTagIdsList"
                size="small"
                :dataList="alarmTags"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="lableName"
                valueName="lableId"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-form-item label="是否3D放大">
              <el-select
                v-model="qryParams.enlargeFlag"
                placeholder="请选择"
                size="small"
                clearable
              >
                <el-option
                  v-for="(item, index) in largeBy3DList"
                  :key="index"
                  :value="item.value"
                  :label="item.name"
                >
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="userIdIsShow">
            <el-form-item label="算法编码">
              <el-input
                v-model.trim="qryParams.algorithmCode"
                placeholder="请输入"
                clearable
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="8" v-if="!userIdIsShow">
            <el-form-item label="告警原因">
              <KeyHighSelect
                v-model="qryParams.alarmReasonList"
                size="small"
                :dataList="alarmCauseList"
                :collapseTags="true"
                :filterable="true"
                :multiple="true"
                :clearable="true"
                placeholder="请选择"
                labelName="reason"
                valueName="reason"
              ></KeyHighSelect>
            </el-form-item>
          </el-col>
        </template>

        <el-row class="page-in" style="margin-top: 0">
          <el-row
            type="flex"
            class="row-bg eventMidRow"
            justify="end"
            :gutter="20"
          >
            <!-- <el-button v-if="!userIdIsShow" v-hasPermi="['event:alarm:add']" @click="toDialog()" type="primary"
              icon="el-icon-plus" style="margin-right: 16px">
              测试弹窗
            </el-button> -->
            <el-button
              v-if="!userIdIsShow"
              v-hasPermi="['event:alarm:add']"
              @click="viewClick(3)"
              type="primary"
              icon="el-icon-plus"
              style="margin-right: 12px"
            >
              新增
            </el-button>
            <el-button
              icon="el-icon-upload2"
              v-hasPermi="['event:alarm:export']"
              @click="leaderExport()"
              style="margin-right: 12px"
              >导出
            </el-button>
            <el-button
              v-hasPermi="['event:alarm:batchjudge']"
              @click="viewClick2(5)"
              :title="'批量研判'"
              v-if="eventWait != '2'"
              style="margin-right: 12px"
            >
              <i
                class="iconfont icon-piliangyanpananniu3x"
                style="font-size: 14px; padding-right: 6px"
              ></i>
              批量研判
            </el-button>
            <el-button
              v-hasPermi="['event:alarm:batchclose']"
              @click="batchDelete(6)"
              :title="'批量关闭'"
              v-if="eventWait != '2'"
              style="margin-right: 12px"
            >
              <i
                class="el-icon-circle-close"
                style="font-size: 14px; padding-right: 6px"
              ></i
              >批量关闭
            </el-button>

            <el-button
              v-hasPermi="['event:alarm:batchdel']"
              @click="deleteOut(7)"
              :title="'批量删除'"
              style="margin-right: 12px"
            >
              <i
                class="el-icon-delete"
                style="font-size: 14px; padding-right: 6px"
              ></i>
              批量删除
            </el-button>
            <el-button
              title="下载告警图片"
              v-hasPermi="['event:alarm:downImg']"
              style="margin-right: 12px"
              @click="downAlarmImg"
            >
              <span class="icon-a-05xiazaitupian iconfont"></span>
              下载告警图片
              <i v-show="imgLoading" class="el-icon-loading"></i
            ></el-button>
            <el-button
              :title="'自定义列'"
              @click="handleColumn"
              v-hasPermi="['event:alarm:customList']"
              v-if="isShowView === 2"
            >
              <i
                class="iconfont icon-zidingyilietubiao"
                style="font-size: 14px"
              ></i>
              自定义列</el-button
            >
            <el-col class="input" style="text-align: right; padding-right: 0">
              <el-button
                v-hasPermi="['event:alarm:query']"
                type="primary"
                size="small"
                icon="el-icon-search"
                @click="queryEventData()"
                style="margin-right: 12px"
                ><span>查询</span></el-button
              >
              <el-button
                v-hasPermi="['event:alarm:reset']"
                size="small"
                icon="el-icon-refresh-right"
                @click="resetData()"
                style="margin-right: 12px"
                ><span>重置</span></el-button
              >
              <el-button
                size="small"
                :icon="showButton ? 'el-icon-arrow-down' : 'el-icon-arrow-up'"
                @click="showSelect()"
              >
                <span>{{ showButton ? "展开" : "收起" }}</span></el-button
              >
            </el-col>
          </el-row>
        </el-row>
      </el-row>
      <hr class="custom-hr" />
      <el-row style="margin: 0px 0px 18px">
        <div
          v-hasPermi="['event:alarm:showList']"
          class="showView iconfont icon-caidanguanli"
          @click="viewClick(2)"
          style="text-align: center; font-size: 22px"
          :style="{ color: this.isShowView == 2 ? '#ffffff' : '#2C2F33' }"
          :class="
            this.isShowView == 2 ? 'eventSelectClass' : 'eventUnSelectClass'
          "
          :title="'列表视图'"
        ></div>
        <div
          v-hasPermi="['event:alarm:showView']"
          class="showView iconfont icon-more"
          style="text-align: center; font-size: 22px"
          @click="viewClick(1)"
          :style="{ color: this.isShowView == 1 ? '#ffffff' : '#2C2F33' }"
          :class="
            this.isShowView == 1 ? 'eventSelectClass' : 'eventUnSelectClass'
          "
          :title="'看板视图'"
        ></div>
      </el-row>
      <el-row :gutter="20">
        <div v-if="isShowView === 1">
          <div style="display: flex; flex-wrap: wrap">
            <el-col
              :span="8"
              :style="index > 2 ? 'margin-top: 24px' : ''"
              v-for="(row, index) in viewDataSouse"
              :key="index"
              :value="row.orderId"
            >
              <viewList
                ref="viewRefs"
                :btnType="row.btntype"
                :pageNum="pageData.currentPage"
                :pageSize="pageData.page_size"
                :viewDataSouse="row"
                :listData="listData"
                :selectList="selectList"
                :isShowByEventWait="isShowByEventWait"
                :pageType="isMyEvent"
                :index="index"
                :clickView="query"
                :btnClickFun="btnClickFun"
                @queryEventData="queryEventData"
                @selectWarn="selectWarn"
                @getViewDataSource="getViewDataSource"
              ></viewList>
            </el-col>
          </div>
        </div>
        <div
          v-if="isShowView === 2"
          :class="['tableStyle', { 'my-already': eventWait === '2' }]"
        >
          <el-table
            border
            style="width: 100%"
            :data="viewDataSouse"
            highlight-current-row
            :row-key="bindRowKey"
            @select="handleTableSelect"
            @select-all="handleSelectionChange"
            ref="checkTable"
            id="eventCheckTable"
            @sort-change="handleSortChange"
            v-loading="tableLoad"
          >
            <el-table-column
              type="selection"
              :reserve-selection="true"
              width="48"
              align="center"
            >
            </el-table-column>
            <template v-for="(item, index) in columns">
              <el-table-column
                align="center"
                :key="item.prop + index"
                :label="item.label"
                :prop="item.prop"
                v-if="item.isShow == false || !item.checked ? false : true"
                :min-width="item.minWidth ? item.minWidth : '120'"
                width="auto"
                :show-overflow-tooltip="!item.hidnTooltip"
                :sortable="item.sort ? 'custom' : false"
              >
                <template v-slot="scope" v-if="item.prop === 'orderId'">
                  <span
                    style="cursor: pointer !important; color: #1890ff"
                    class="spanStyle"
                    @click="query(scope.row)"
                    :title="scope.row.orderId"
                    >{{ scope.row.orderId }}</span
                  >
                </template>
                <template v-slot="scope" v-else-if="item.prop === 'alarmImg'">
                  <div
                    class="img-wrapper"
                    @contextmenu.prevent="disableContextmenu"
                  >
                    <el-tooltip
                      placement="top"
                      effect="light"
                      :visible-arrow="false"
                      popper-class="myEventListTooltip"
                      :enterable="false"
                      v-for="(item, index) in getAlarmImgUrl(scope)"
                      :key="item + index"
                    >
                      <el-image :src="item" class="table-img" alt="">
                        <div slot="error" class="image-slot">
                          <img :src="defaultImg" class="" alt="" />
                        </div>
                      </el-image>
                      <div slot="content">
                        <el-image
                          @contextmenu.prevent="disableContextmenu"
                          :src="item"
                          class="table-img-tooltip"
                          alt=""
                        >
                          <div slot="error" class="image-slot">
                            <img :src="defaultImg" class="" alt="" />
                          </div>
                        </el-image>
                      </div>
                    </el-tooltip>
                  </div>
                  <!-- <EventImages :images="getAlarmImgUrl(scope)"  width="50px" height="38px"/> -->
                </template>
                <template
                  v-slot="scope"
                  v-else-if="item.prop === 'confidenceLevel'"
                >
                  <span>{{
                    scope.row.compConfidenceLevel
                      ? scope.row.compConfidenceLevel
                      : scope.row.confidenceLevel
                      ? scope.row.confidenceLevel
                      : "-"
                  }}</span>
                </template>
                <template
                  v-slot="scope"
                  v-else-if="item.prop === 'orderStatusName'"
                >
                  <span>{{
                    scope.row.enableAcceptanceMode === "1"
                      ? "待受理"
                      : scope.row.orderStatusName
                  }}</span>
                </template>
                <template v-slot="scope" v-else-if="item.prop === 'alarmTime'">
                  <span class="spanStyle" :title="scope.row.alarmTime">{{
                    timeStr(scope.row.alarmTime)
                  }}</span>
                </template>
                <template v-slot="scope" v-else-if="item.prop === 'reciveTime'">
                  <span class="spanStyle" :title="scope.row.reciveTime">{{
                    timeStr(scope.row.reciveTime)
                  }}</span>
                </template>
              </el-table-column>
            </template>
            <el-table-column
              v-if="isShowByEventWait"
              width="100"
              label="操作"
              align="center"
              fixed="right"
            >
              <template slot-scope="scope">
                <el-button
                  class="text-style"
                  plain
                  size="mini"
                  type="text"
                  v-if="
                    scope.row.orderStatus !== '0' &&
                    scope.row.orderStatus !== '6' &&
                    scope.row.orderStatus !== '7' &&
                    scope.row.ifEdit != '0'
                  "
                  v-hasPermi="authority(scope.row)"
                  :style="{
                    cursor: scope.row.ifEdit == '0' ? 'not-allowed' : 'pointer',
                  }"
                  @click="btnClickFun(scope.row)"
                  v-html="btnNameFun(scope.row)"
                >
                  <!-- {{ btnNameFun(scope.row) }} -->
                </el-button>
                <el-button
                  size="mini"
                  type="text"
                  @click="query(scope.row)"
                  :style="{
                    cursor: 'pointer',
                    color: '#1890FF',
                    'background-color': 'white',
                  }"
                  v-show="
                    (scope.row.orderStatus !== '1' &&
                      scope.row.orderStatus !== '2' &&
                      scope.row.orderStatus !== '3' &&
                      scope.row.orderStatus !== '4' &&
                      scope.row.orderStatus !== '5') ||
                    scope.row.ifEdit == '0'
                  "
                  ><span
                    class="iconfont icon-chakan"
                    style="font-size: 14px"
                  ></span>
                  <span class="text-style">查看</span>
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-row>
      <el-row
        type="flex"
        justify="end"
        v-show="isShowView === 1 || isShowView === 2"
      >
        <span style="line-height: 52px; color: #606266; font-size: 13px"
          >已勾选{{ selectList.length }}条,</span
        >
        <el-pagination
          style="float: right; border: none; margin: 10px 0"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageData.currentPage"
          :page-sizes="pageData.page_sizes"
          :page-size="pageData.page_size"
          layout="total, sizes, prev, pager, next, jumper"
          :total="pageData.total"
          background
        >
        </el-pagination>
      </el-row>
    </el-form>
    <!---------------------------------dialog--------------------------->
    <!--批量研判弹窗dialog-->
    <batchJudgeDialog
      @batchJudgeFun="batchJudgeFun"
      :selectList="selectList"
      :isbatchJudge="isbatchJudge"
      @loadInit="loadInit"
      @resetSelect="resetSelect"
    ></batchJudgeDialog>
    <!-- 事件上报弹窗 -->
    <eventAddDialog
      ref="eventAddDialog"
      @loadInit="loadInit"
      @addClose="addShowFnc"
      :addShowIf="addShow"
      v-if="addShow"
    >
    </eventAddDialog>
    <sorTableList
      :columns.sync="columns"
      :memoryType="sortListData.memoryType"
      :defaultList="defaultList"
      :dialogVisible.sync="sortListData.dialogVisible"
      @doLayout="doLayout"
      :hideHandleBtn="eventWait === '2'"
    ></sorTableList>

    <el-dialog
      title="批量关闭"
      :visible.sync="closeRemarkVisible"
      width="560px"
      class="dialogInput"
    >
      <el-form label-width="80px">
        <el-form-item label="关闭说明">
          <el-input
            v-model="closeRemark"
            type="textarea"
            resize="none"
            style="height: 60px"
            maxlength="200"
            placeholder="请输入"
          ></el-input>
          <span class="span_top">将当前告警事件进行关闭</span>
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer" style="display: inline-flex">
        <el-button
          type="primary"
          @click="viewClick2(6)"
          style="margin-right: 12px"
          >确 定</el-button
        >
        <el-button @click="clearCloseRemark">取 消</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="批量删除"
      :visible.sync="deleteRemarkVisible"
      width="560px"
      class="dialogInput"
    >
      <el-form label-width="80px">
        <el-form-item label="删除说明">
          <el-input
            v-model="deleteRemark"
            type="textarea"
            resize="none"
            style="height: 60px"
            maxlength="200"
            placeholder="请输入"
          ></el-input>
          <span class="span_top"
            >将选中的告警事件进行删除，可进入回收站查看</span
          >
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer" style="display: inline-flex">
        <el-button
          type="primary"
          @click="viewClick2(7)"
          style="margin-right: 12px"
          >确 定</el-button
        >
        <el-button @click="clearDeleteRemark">取 消</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { DateFormat, $getUrlParam } from "@/utils/public";
import {
  queryTenantInfo,
  getRegion,
  getDeviceList,
  queryTenant,
  queryTenantLabelList,
  getOrderList,
  findOrderAlarm,
  getEnumInfo,
  getCustOrganTreeNew,
  batchDelWarningOrder,
  batchEndWarningOrder,
  querySysLinkViewUrl,
  getCurrentByOrderIdAndLinkId,
  getAllLables,
  downLoadZipPost,
  getIotDeviceList,
  queryAlarmReasonList,
} from "@/api/modules/eventManagement/eventManagement";
import { getPreference, modify } from "@/api/system/user.js";
import { getAllTags } from "@/api/modules/configManagemnet/labelConfig.js";
import viewList from "./view.vue";
import batchJudgeDialog from "./batchDialog/batchJudgeDialog";
import eventAddDialog from "./eventAddDialog.vue";
// import '@static/font/iconfont.css';
import "@/assets/font/iconfont.css";
import $ from "jquery";
import sorTableList from "@/components/eventManagement/sorTableList";
import { getUserMemoryOperate } from "@/api/system/custom";
import defaultImg from "@/assets/image/demoImg.png";
import EventImages from "./components/EventImages.vue";
import { trackingMixin } from '@/mixins/trackingMixin.js'
//直辖市编码集合
const municipalityCodes = [
  "110000", //北京
  "120000", //天津
  "310000", //上海
  "500000", //重庆
];
let choiceDate0 = "";
import KeyHighSelect from "@/components/form/KeyHighSelect.vue";
export default {
  name: "eManagement",
  components: {
    viewList,
    batchJudgeDialog,
    eventAddDialog,
    sorTableList,
    EventImages,
    KeyHighSelect,
  },
  mixins: [trackingMixin],
  packageInfo: {
    screenData: {
      screenName: '事件查询',
      screenVersion: 'tongyong_shijianchaxun_1-6-80_20250514'
    }
  },
  props: {
    isMyEvent: {
      type: Boolean,
      default: false,
    },
    eventWait: {
      type: String,
      default: "",
    },
  },
  data() {
    return {
      defaultImg,
      loginInfo: "",
      treeTypeUserId: "",
      treeTypeChoose: 2,
      addShow: false,
      tagList: [],
      largeBy3DList: [
        {
          name: "是",
          value: "1",
        },
        {
          name: "否",
          value: "0",
        },
      ],
      isbatchJudge: false,
      selectList: [],
      showButton: true,
      showInputFlag: false,
      loading: false,
      tenantList: [], //租户列表
      tenantkeyword: "",

      tenantData: [],
      pagintionShowStatus1: 0,
      tenantPageData: {
        total: 0,
        page_sizes: [5, 10, 25, 50],
        currentPage: 1,
        page_size: 5,
      },
      type: "",
      userIdIsShow: true, // 判断铁塔或租户视角
      custIsShow: false,
      isShowView: 1,
      qryParams: {
        //查询入参
        tagIdList: [],
        secondJudgeResult: "",
        isSecondJudge: "",
        orderId: "",
        eventTitle: "", //事件标题
        area: "", //所属区域
        warnTime: [], //告警时间
        eventType: [], //告警类型
        eventSourse: "", //告警来源
        eventLevel: "", //事件等级
        eventState: "", //事件状态
        eventWait: "", //待办状态
        tenantId: "", //租户id
        tenantData: "", //租户全称
        deviceCode: "", //设备编码
        deviceCode2: "", //设备名称转编码
        importanceLevel: "", //重要等级
        ifTimeOut: "", //是否超期
        judgeResult: "", //研判结果
        isCollection: "", // '0'未收藏  '1'收藏
        orgIds: [], //组织
        areaIds: [],
        areaCodeList: [], // 铁塔组织
        deviceLabelId: [], //标签ID
        noticeResource: "", // AI告警来源
        enlargeFlag: "",
        sortName: "",
        sort: "", // asc, desc
        confidenceLevelMin: "", // 置信度最小值
        minChar: "100", // 置信度左边符号
        confidenceLevelMax: "",
        maxChar: "100",
        alarmTagIdsList: [],
        algorithmCode: "",
        alarmReasonList: [], // 告警原因
      },
      searchParams: {}, // 真实查询入参
      prevSearch: {
        params: {},
        total: 0,
      }, // 上一次查询
      selectDataSource: {
        //下拉数据源
        areaOptions: [],
        eventTypeList: [], //告警类型
        DeviceList: [], //摄像头名称
        eventSourceList: [], //告警来源
        eventLevelList: [], //事件等级
        noticeResourceList: [], // AI告警来源
        videofactoryList: [], //视频厂商
        msgList: [], //消息类型
        eventStateList: [
          {
            //事件状态
            enumCode: "1",
            enumName: "待研判",
          },
        ],
        eventWaitList: [
          {
            enumCode: "1",
            enumName: "待办",
          },
          {
            enumCode: "2",
            enumName: "已办",
          },
        ], //事件待办
        importanceLevelList: [], //告警重要等级
        deviceLabelList: [], //设备标签列表
        iotDeviceList: [], //物联设备名称
      },
      viewDataSouse: [], //视图数据源
      listData: [], //过滤只要orderId 和orderStatus
      pageData: {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      },
      orgTreeData: [], // 组织树数据
      orgTreeProp: {
        multiple: true,
        checkStrictly: true,
        label: "deptName",
        value: "deptId",
        children: "children",
      },
      iframeUrl: "http://10.128.9.31:8080/test.html",
      tableLoad: false,
      activatedFlag: false,
      confidenceLevelSelectData: [
        {
          value: "100",
          label: "<",
        },
        {
          value: "101",
          label: "≤",
        },
      ],
      // pickerOptions:{
      //   onPick: ({maxDate, minDate}) => {
      //     choiceDate0 = minDate.getTime();
      //     if(maxDate) {
      //       choiceDate0 = '';
      //     }
      //   },
      //   //2021-7
      //   disabledDate(time) {
      //     var nowDate=new Date();
      //     var futureDate=new Date(nowDate.getFullYear(),nowDate.getMonth() + 1,0);
      //     var nextDate=new Date("2021-7-1");
      //     var days=(nowDate.getTime() - nextDate.getTime())/(1000*60*60*24);
      //     let curDate = (new Date()).getTime();
      //     let three = days * 24 * 3600 * 1000;
      //     let threeMonths = curDate - three;
      //     futureDate = futureDate.getTime() + 24 * 3600 * 1000 - 1;
      //     let choiceDateTime = new Date(choiceDate0).getTime();
      //     const minTime = new Date(choiceDateTime).setMonth(new Date(choiceDateTime).getMonth() - 6);
      //     const maxTime = new Date(choiceDateTime).setMonth(new Date(choiceDateTime).getMonth() + 6);
      //     const min = minTime;
      //     const max = futureDate < maxTime ? futureDate : maxTime;
      //     //如果已经选中一个日期，则返回该日期前后一个月时间可选
      //     if(choiceDate0) {
      //       return time.getTime() < min || time.getTime()  > max;
      //     }
      //     //如果一个日期都没选中，则返回当前日期之前的日期可选
      //     return time.getTime() > futureDate || time.getTime() < threeMonths;
      //   }
      // },
      pickerOptions: {},
      alarmTags: [], // 告警标签
      sortListData: {
        dialogVisible: false, // 自定义弹窗显隐
        memoryType: "3", //自定义列（3、事件查询、我的事件（4待办、5已办、6收藏）、7领导批示、8卫星告警）
      },
      defaultList: [], // 自定义default数组
      columns: [
        {
          label: "事件编号",
          prop: "orderId",
          minWidth: "250",
          checked: true,
          checkedDisable: true,
        },
        {
          label: "事件标题",
          prop: "alarmBody",
          minWidth: "150",
          checked: true,
        },
        {
          label: "告警图片",
          prop: "alarmImg",
          minWidth: "180",
          checked: true,
          checkedDisable: true,
          preViewImg: true,
          hidnTooltip: true,
        },
        {
          label: "告警类型",
          prop: "warningTypeName",
          minWidth: "180",
          checked: true,
        },
        {
          label: "置信度",
          prop: "confidenceLevel",
          minWidth: "110",
          checked: true,
        },
        {
          label: "事件状态",
          prop: "orderStatusName",
          minWidth: "80",
          checked: true,
        },
        {
          label: "告警时间",
          prop: "alarmTime",
          minWidth: "200",
          checked: true,
          sort: true,
        },
        {
          label: "接收时间",
          prop: "reciveTime",
          minWidth: "200",
          checked: true,
          sort: true,
        },
      ],
      towerColumns: [
        {
          label: "客户ID",
          prop: "tenantId",
          minWidth: "120",
          checked: true,
        },
        {
          label: "客户名称",
          prop: "tenantName",
          minWidth: "125",
          checked: true,
        },
        {
          label: "行业应用",
          prop: "industryName",
          minWidth: "125",
          checked: true,
        },
        {
          label: "应用版本",
          prop: "appVerCode",
          minWidth: "125",
          checked: true,
        },
      ],
      imgLoading: false,
      closeRemark: "", // 批量关闭关闭说明
      closeRemarkVisible: false,
      deleteRemark: "", // 批量删除关闭说明
      deleteRemarkVisible: false,
      alarmCauseList: [],
      tab: "1", // 页签配置 默认事件查询
    };
  },
  computed: {
    isShowByEventWait() {
      if (this.isMyEvent && this.eventWait == "2") {
        return false;
      }
      return true;
    },
    getAlarmImgUrl() {
      return (scope) => {
        try {
          let imgUrl = [];
          /**
           * 卫星告警   展示专题图或红外图，任意一个没有则展示原图   透传字段和imgUrl
           * 其他告警   左边展示框图，右边展示原图    fileImgUrlIcon 和imgUrl
           * 都没有的话则展示默认图（一般为物联告警）
           */
          if (scope.row.warningSource !== "9") {
            // 非卫星告警
            if (scope.row.fileImgUrlIcon) {
              // 框图
              imgUrl.push(scope.row.fileImgUrlIcon.split(",")[0]);
            }
            if (scope.row.imgUrl) {
              // 原图
              imgUrl.push(scope.row.imgUrl.split(",")[0]);
            }
          } else {
            if (scope.row.extraField) {
              let extraField = JSON.parse(scope.row.extraField);
              if (extraField.relativePathMir)
                imgUrl.push(extraField.relativePathMir); // 红外图
              if (extraField.relativePathThem)
                imgUrl.push(extraField.relativePathThem); // 专题图
            }
            if (imgUrl.length === 1 && scope.row.imgUrl) {
              imgUrl.push(scope.row.imgUrl.split(",")[0]); // 任意一个没有则展示一张原图
            }
            if (!imgUrl.length && scope.row.imgUrl) {
              // 都不存在则展示两张原图
              imgUrl.push(scope.row.imgUrl.split(",")[0]);
              imgUrl.push(scope.row.imgUrl.split(",")[0]);
            }
          }
          if (!imgUrl.length) {
            imgUrl.push(defaultImg);
          }
          return imgUrl;
        } catch (e) {
          return [defaultImg];
        }
      };
    },
  },
  watch: {
    "qryParams.isSecondJudge": {
      handler: function () {
        //是否二次研判清空时，二次研判结果也要清空
        if (
          !this.qryParams.isSecondJudge ||
          this.qryParams.isSecondJudge == "0"
        ) {
          this.qryParams.secondJudgeResult = "";
          return;
        }
      },
    },
    // $route(to, from) {
    //   if (
    //     to.fullPath !== from.fullPath &&
    //     to.query.clear === undefined &&
    //     to.query.keep === undefined
    //   ) {
    //     this.loadInit();
    //   }
    // },
  },
  async created() {
    this.getCustomList();
    this.loginInfo = this.$store.getters.userInfo;
    // 我的事件嵌入告警事件时，默认查询待办或者已办
    if (this.isMyEvent && this.eventWait) {
      this.qryParams.eventWait = this.eventWait;
    }
    getEnumInfo({
      enumTypeId: 103,
    }).then((res) => {
      if (res.code == 200) {
        this.selectDataSource.videofactoryList = res.data;
      }
    });
    getEnumInfo({
      enumTypeId: 102,
    }).then((res) => {
      if (res.code == 200) {
        this.selectDataSource.noticeResourceList = res.data;
      }
    });
    getEnumInfo({
      enumTypeId: 104,
    }).then((res) => {
      if (res.code == 200) {
        this.selectDataSource.msgList = res.data;
      }
    });
    var query = this.$route.query;
    if (query) {
      this.qryParams.deviceCode = query.deviceCode;
      if (query.deviceName) {
        this.qryParams.deviceCode2 = decodeURIComponent(query.deviceName);
      }
      if (query.iotName) {
        this.qryParams.iotDeviceCode2 = decodeURIComponent(query.iotName);
      }
      this.handleLyParams({
        deviceName: decodeURIComponent(query.deviceName) || "",
        iotName: decodeURIComponent(query.iotName) || "",
      });
    }
  },
  async activated() {
    if (this.$store.getters.userType !== "0") {
      getAllLables().then((res) => {
        if (res.code == 200) {
          this.alarmTags = res.data;
        }
      });
    }
    if (this.$route.query.deviceName) {
      this.qryParams.deviceCode2 = decodeURIComponent(
        this.$route.query.deviceName
      );
    }
    if (this.$route.query.iotName) {
      this.qryParams.iotDeviceCode2 = decodeURIComponent(
        this.$route.query.iotName
      );
    }
    this.handleLyParams({
      deviceName: decodeURIComponent(this.$route.query.deviceName) || "",
      iotName: decodeURIComponent(this.$route.query.iotName) || "",
    });
    // this.qryParams.warnTime=[]
    if (this.$route.params.remark === "workbench") {
      if (this.$route.params.status == 2) {
        this.qryParams.warnTime = [
          this.$route.params.time1,
          this.$route.params.time2,
        ]; //今日时间
        this.qryParams.eventState = [];
      } else {
        this.qryParams.warnTime = [];
      }
      if (this.$route.params.status == 1) {
        this.qryParams.eventState = ["1", "2", "5", "4", "9"]; //状态
        this.getSixMonths(6);
      }
      if (this.$route.params.status == 0) {
        this.qryParams.eventState = ["6"];
        this.getSixMonths(6);
      }

      this.getViewDataSource(this.qryParams);
    } else {
      if (this.$route.query.dn) {
        await this.getDevice(this.$route.query.dn);
        this.qryParams.deviceCode2 =
          this.selectDataSource.DeviceList[0]?.deviceCode;
        this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
      }
      //跳转回本页面触发
      this.activatedFlag
        ? this.getViewDataSource(true)
        : (this.activatedFlag = true);
    }
  },
  deactivated() {
    this.$refs.eventAddDialog?.close();
  },
  async mounted() {
    let _this = this;
    //接收跳转页面传参
    _this.getTreeType().then(() => {
      if (this.treeTypeChoose == 1) {
        this.handleCheckData();
        this.isShowView = 2;
      }
    });
    const wt = $getUrlParam("wt");
    const tt = $getUrlParam("tt"); // 告警类型标签
    const os = $getUrlParam("os");
    const el = $getUrlParam("el");
    const es = $getUrlParam("es");
    const dc = decodeURIComponent($getUrlParam("dc"));
    const dn = decodeURIComponent($getUrlParam("dn"));
    const wTime = $getUrlParam("wTime");
    const pd = $getUrlParam("pd");
    const cd = $getUrlParam("cd");
    const cyd = $getUrlParam("cyd");
    const std = $getUrlParam("std");
    const st = $getUrlParam("st");
    const et = $getUrlParam("et");
    const orderId = $getUrlParam("orderId");
    const deviceName = decodeURIComponent($getUrlParam("deviceName"));
    const iotName = decodeURIComponent($getUrlParam("iotName"));
    const iotCode = $getUrlParam("iotCode");
    if (orderId) {
      this.qryParams.orderId = orderId;
    }
    const warnTime = [];
    if (st) {
      warnTime.push(decodeURIComponent(st));
    }
    if (et) {
      warnTime.push(decodeURIComponent(et));
    }
    this.qryParams.warnTime = warnTime;

    if (wt) {
      this.qryParams.eventType = [wt];
    }
    if (tt) {
      this.qryParams.tagIdList = [parseInt(tt)];
    }
    if (os) {
      if (os == "four") {
        this.qryParams.eventState = ["1", "2", "4", "5"];
      } else {
        this.qryParams.eventState = os.split(",");
      }
    }
    if (el) {
      this.qryParams.eventLevel = el;
    }
    if (es) {
      this.qryParams.eventSourse = es;
    }
    if (dc) {
      this.qryParams.deviceCode = dc;
    }
    if (dn) {
      // this.qryParams.deviceCode2 = dn;
    }
    if (deviceName) {
      this.qryParams.deviceCode2 = deviceName;
    }
    if (iotName) {
      this.qryParams.iotDeviceCode2 = iotName;
    }
    if (iotCode) {
      this.qryParams.iotDeviceCode = iotCode;
    }
    this.handleLyParams({
      deviceName: deviceName || "",
      iotName: iotName || "",
    });
    const area = [];
    if (pd) {
      area.push(pd);
    }
    if (cd) {
      area.push(cd);
    }
    if (cyd) {
      area.push(cyd);
    }
    if (std) {
      area.push(std);
    }
    this.qryParams.area = area;

    // this.qryParams.warnTime = [];
    if (wTime && wTime === "1") {
      this.qryParams.warnTime.push(this.getStrDate(1, 0) + " 00:00:00");
      this.qryParams.warnTime.push(this.getStrDate(1, 0) + " 23:59:59");
    } else if (wTime === "30") {
      this.qryParams.warnTime.push(this.getStrDate(2, -1) + " 00:00:00");
      this.qryParams.warnTime.push(this.getStrDate(2, 0) + " 23:59:59");
    } else if (wTime === "365") {
      this.qryParams.warnTime.push(this.getStrDate(3, -1) + " 00:00:00");
      this.qryParams.warnTime.push(this.getStrDate(3, 0) + " 23:59:59");
    } else if (wTime === "thisMonth") {
      this.qryParams.warnTime.push(this.getStrDate(22, 0) + " 00:00:00");
      this.qryParams.warnTime.push(this.getStrDate(3, 0) + " 23:59:59");
    } else if (wTime === "thisYear") {
      this.qryParams.warnTime.push(this.getStrDate(23, 0) + " 00:00:00");
      this.qryParams.warnTime.push(this.getStrDate(3, 0) + " 23:59:59");
    }

    window.addEventListener("click", _this.clickAll1); //检测鼠标点击事件

    $("#searchid1 .el-icon-search").click(function () {
      if (_this.qryParams.tenantId != "" || _this.qryParams.tenantId != null) {
        _this.tenantPageData = {
          total: 0,
          page_sizes: [5, 10, 25, 50],
          currentPage: 1,
          page_size: 5,
        };
        _this.getTenantData();
      }
    });
    $("#searchid1 .el-icon-circle-close").click(() => {
      _this.qryParams.tenantId = null;
      _this.qryParams.tenantData = null;
    });
    if (this.$route.query.dn) {
      await this.getDevice(this.$route.query.dn);
      let fromQueryList = this.selectDataSource.DeviceList.filter((item) => {
        return this.$route.query.dn === item.devName;
      });
      if (fromQueryList.length > 0) {
        this.qryParams.deviceCode2 = fromQueryList[0].deviceCode;
      } else {
        this.qryParams.deviceCode2 =
          this.selectDataSource.DeviceList[0]?.deviceCode;
      }
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    }
    _this.loadInit();
    if (!this.qryParams.warnTime || this.qryParams.warnTime.length == 0) {
      this.getSixMonths();
    }

    $(".el-button--primary").bind("DOMNodeInserted", function (e) {});
  },
  // activated() {
  //   this.getViewDataSource();
  // },
  methods: {
    // clickChange(){
    //   console.log(this.treeTypeChoose);
    // },
    async toDialog() {
      // this.$router.push({
      //   path:'/myDialog'
      // })
      // 发出打开弹窗通讯
      // await iframeSDK( {
      //   iframeOperationId: 'addUrl', // 操作名称
      //   url: 'https://baidu.com',
      //   username: 'Mark.Yuan',
      //   company: 'china'
      // })
    },
    // 设置快捷日期方式
    setPickerOptions() {
      let selectDate = "";
      let _this = this;
      this.pickerOptions = {
        shortcuts: [
          {
            text: "今日",
            onClick(picker) {
              const start = new Date();
              const end = new Date();
              picker.$emit("pick", _this.getTimestampsForPastXDays());
            },
          },
          {
            text: "近3天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(3));
            },
          },
          {
            text: "近7天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(7));
            },
          },
          {
            text: "近30天",
            onClick(picker) {
              picker.$emit("pick", _this.getTimestampsForPastXDays(30));
            },
          },
        ],
        onPick: ({ maxDate, minDate }) => {
          choiceDate0 = minDate.getTime();
          if (maxDate) {
            choiceDate0 = "";
          }
        },
        disabledDate(time) {
          var nowDate = new Date();
          var futureDate = new Date(
            nowDate.getFullYear(),
            nowDate.getMonth() + 1,
            0
          );
          var nextDate = new Date("2021-7-1");
          var days =
            (nowDate.getTime() - nextDate.getTime()) / (1000 * 60 * 60 * 24);
          let curDate = new Date().getTime();
          let three = days * 24 * 3600 * 1000;
          let threeMonths = curDate - three;
          futureDate = futureDate.getTime() + 24 * 3600 * 1000 - 1;
          let choiceDateTime = new Date(choiceDate0).getTime();
          const minTime = new Date(choiceDateTime).setMonth(
            new Date(choiceDateTime).getMonth() - 6
          );
          const maxTime = new Date(choiceDateTime).setMonth(
            new Date(choiceDateTime).getMonth() + 6
          );
          const min = minTime;
          const max = futureDate < maxTime ? futureDate : maxTime;
          //如果已经选中一个日期，则返回该日期前后一个月时间可选
          if (choiceDate0) {
            return time.getTime() < min || time.getTime() > max;
          }
          //如果一个日期都没选中，则返回当前日期之前的日期可选
          return time.getTime() > futureDate || time.getTime() < threeMonths;
        },
      };
    },
    handleCascaderChange(val) {
      let nodes = this.$refs.orgName
        .getCheckedNodes()
        .filter((node) => node.level !== 1);
      const map = {};
      nodes = nodes.map((node) => {
        const areaCode = node.level === 2 ? node.value : node.parent.value;
        const v = {
          areaCode,
          isDirectly: municipalityCodes.includes(areaCode) ? "1" : undefined,
          childrenAreaCodeList: [],
        };
        if (!map[areaCode]) {
          map[areaCode] = v;
        }
        if (node.level === 3) {
          map[areaCode].childrenAreaCodeList.push(node.value);
        }
        return map[areaCode];
      });
      const result = [];
      nodes.reduce((prev, cur) => {
        if (prev.areaCode !== cur.areaCode) {
          result.push(cur);
        }
        return cur;
      }, {});
      this.qryParams.areaCodeList = val.length > 0 ? result : [];
    },
    handleSortChange({ prop, order }) {
      if (order) {
        this.qryParams.sortName = prop;
        this.qryParams.sort = order === "ascending" ? "asc" : "desc";
      } else {
        this.qryParams.sortName = "";
        this.qryParams.sort = "";
      }
      this.queryEventData();
    },
    async getTreeType() {
      this.treeTypeUserId = this.loginInfo.userId;
      // 铁塔视角切换为客户视角时，判断userId是否随切视角变化?
      if (!this.loginInfo.tenantId) {
        this.treeTypeUserId = this.loginInfo.userId;
      }
      const param = {
        prefPage: "22",
        prefType: "53",
        userId: this.treeTypeUserId,
      };
      try {
        const res = await getPreference(param);
        if (res.code == "200") {
          const { prefValue = "2", sysUserPrefId } = res.data[0] || {};
          this.sysUserPrefTreeTypeId = sysUserPrefId;
          this.treeTypeChoose = prefValue;
        } else {
          throw new Error(res?.msg);
        }
      } catch (error) {
        throw new Error(error);
      }
    },
    /**
     * 存储 树类型
     */
    async doChangeTreeType() {
      const prefValue = this.treeTypeChoose == "1" ? "2" : "1";
      const res = await modify({
        prefPage: "22",
        prefType: "53",
        prefValue,
        userId: this.treeTypeUserId,
        sysUserPrefId: this.sysUserPrefTreeTypeId,
      });
      if (res.code == "200") {
        this.treeTypeChoose = prefValue;
      }
    },
    openAdd() {
      this.addShow = true;
    },
    addShowFnc() {
      this.addShow = false;
    },
    getAllTags() {
      getAllTags().then((res) => {
        if (res.code == 200) {
          this.tagList = res.data;
        }
      });
    },
    resetSelect() {
      this.selectList = [];
      if (this.$refs.checkTable) {
        this.$refs.checkTable.clearSelection();
      }
    },
    batchJudgeFun() {
      this.isbatchJudge = false;
    },
    bindRowKey(row) {
      return row.orderId;
    },
    handleTableSelect(val, row) {
      const index = this.selectList.findIndex(
        (item) => item.orderId == row.orderId
      );
      if (index == -1) {
        this.selectList.push(row);
      } else {
        this.selectList.splice(index, 1);
      }
      if (this.selectList.length > 10) {
        $message.warning(`当前已选择` + this.selectList.length + `条。`);
      }
    },
    handleSelectionChange(val) {
      const checked = !$("#eventCheckTable thead .el-checkbox").hasClass(
        "is-checked"
      );
      if (!checked) {
        this.selectList = this.selectList.filter(
          (item) =>
            !this.viewDataSouse.find((obj) => item.orderId == obj.orderId)
        );
      } else {
        this.viewDataSouse.forEach((item) => {
          if (!this.selectList.find((obj) => item.orderId == obj.orderId)) {
            this.selectList.push(item);
          }
        });
      }
      // this.selectList = val;
      if (this.selectList.length > 10) {
        $message.warning(`当前已选择` + this.selectList.length + `条。`);
      }
    },
    getSearchParams() {
      let _this = this;
      let $loginInfo = _this.$store.getters.userInfo;
      let params = {
        cityId: this.getCityId(this.qryParams.area),
        provinceId: this.getProvinceId(this.qryParams.area),
        countyId: this.getCountyId(this.qryParams.area),
        pageNum: this.pageData.currentPage,
        pageSize: this.pageData.page_size,
        modelId: _this.qryParams.modelId == "" ? null : _this.qryParams.modelId,
        noticeResource:
          _this.qryParams.noticeResource == ""
            ? null
            : _this.qryParams.noticeResource,
        // confidenceLevel: _this.qryParams.confidenceLevel == "" ?
        //   null :
        //   _this.qryParams.confidenceLevel,
        confidenceLevelMin: this.qryParams.confidenceLevelMin,
        confidenceLevelMax: this.qryParams.confidenceLevelMax,
        minChar: this.qryParams.minChar,
        maxChar: this.qryParams.maxChar,
        msgType: _this.qryParams.msgType == "" ? null : _this.qryParams.msgType,
        algorithmCode:
          _this.qryParams.algorithmCode == ""
            ? null
            : _this.qryParams.algorithmCode,
      };
      if (this.qryParams.warnTime && this.qryParams.warnTime.length > 0) {
        params.alarmTimeStart = this.qryParams.warnTime[0];
        params.alarmTimeEnd = this.qryParams.warnTime[1];
      }

      this.addParam(params, "orderId", this.qryParams.orderId);
      this.addParam(params, "alarmBody", this.qryParams.eventTitle);
      this.addParam(params, "warningSource", this.qryParams.eventSourse);
      // this.addParam(params, "emergencyLevel", this.qryParams.eventLevel);
      this.addParam(params, "warningTypeIdList", this.qryParams.eventType);
      this.addParam(params, "ifTimeOut", this.qryParams.ifTimeOut);
      this.addParam(params, "orderStatusList", this.qryParams.eventState);
      this.addParam(params, "searchType", this.qryParams.eventWait, "0");
      this.addParam(params, "judgeResult", this.qryParams.judgeResult);
      this.addParam(params, "isCollection", this.qryParams.isCollection);
      this.addParam(params, "deviceLabelIdList", this.qryParams.deviceLabelId);
      this.addParam(params, "tagIdList", this.qryParams.tagIdList);
      this.addParam(params, "isSecondJudge", this.qryParams.isSecondJudge);
      this.addParam(params, "sortName", this.qryParams.sortName);
      this.addParam(params, "sort", this.qryParams["sort"]);
      this.addParam(params, "areaCodeList", this.qryParams.areaCodeList);
      this.addParam(params, "enlargeFlag", this.qryParams.enlargeFlag);
      this.addParam(
        params,
        "secondJudgeResult",
        this.qryParams.secondJudgeResult
      );
      // 物联设备
      const codes = [];
      const { iotDeviceCode, iotDeviceCode2 } = this.qryParams;
      if (iotDeviceCode) codes.push(iotDeviceCode);
      if (iotDeviceCode2) codes.push(iotDeviceCode2);
      if (codes.length) this.addParam(params, "iotDeviceCode", codes);
      // 二次识别
      this.addParam(
        params,
        "isSecondIdentify",
        this.qryParams.isSecondIdentify
      );
      this.addParam(
        params,
        "secondIdentifyResult",
        this.qryParams.secondIdentifyResult
      );
      // 组织名称

      const { orgIds = [] } = this.qryParams;
      let orgIdList = "";
      if (orgIds.length > 0) {
        orgIdList = orgIds.map((item) => {
          return item[item.length - 1];
        });
      }
      this.addParam(params, "orgIdList", orgIdList);
      this.addParam(
        params,
        "tenantId",
        this.qryParams.tenantId,
        $loginInfo.tenantId
      );
      this.addParam(params, "importanceLevel", this.qryParams.importanceLevel);

      let device = [];
      if (this.qryParams.deviceCode) {
        device.push(this.qryParams.deviceCode);
      }
      if (this.qryParams.deviceCode2) {
        device.push(this.qryParams.deviceCode2);
      }
      params.deviceCode = device;
      params.lableIdList = this.qryParams.alarmTagIdsList;
      params.alarmReasonList = this.qryParams.alarmReasonList;
      return params;
    },
    leaderExport() {
      let params = this.prevSearch.params;
      params.warningOrderIds = this.selectList.map((item) => item.orderId);
      let isevent = "";
      if (this.$store.getters.userInfo.tenantId) {
        isevent = "/export";
      } else {
        isevent = "/ttexport";
      }
      let url = isevent + `/alarm/order/exportWarningOrderList`;
      if (this.prevSearch.total >= 5000 && this.selectList.length == 0) {
        $message.warning("导出数据量最多5000条，请按照查询条件导出。");
      } else {
        this.exportExcel(
          url,
          params,
          this.isMyEvent ? "我的事件导出文件" : "事件查询导出文件"
        );
      }
    },
    showSelect() {
      let _this = this;
      _this.showButton = !_this.showButton;
    },

    //type:1天 2月 3年 22当月 23当年
    getStrDate(type, value) {
      let now = new Date();
      let month = now.getMonth() + 1;
      let date = new Date();
      date.setDate(date.getDate() + value);
      switch (type) {
        case 23:
          return date.getFullYear() + "-01-01";
        case 22:
          return (
            date.getFullYear() +
            "-" +
            (date.getMonth() + 1 < 10 ? "0" : "") +
            (date.getMonth() + 1) +
            "-01"
          );
        case 1:
          return (
            date.getFullYear() +
            "-" +
            (date.getMonth() + 1 < 10 ? "0" : "") +
            (date.getMonth() + 1) +
            "-" +
            (date.getDate() < 10 ? "0" : "") +
            date.getDate()
          );
        case 2:
          return (
            now.getFullYear() +
            "-" +
            (month + value < 10 ? "0" : "") +
            (month + value) +
            "-" +
            (now.getDate() < 10 ? "0" : "") +
            now.getDate()
          );
        case 3:
          return (
            now.getFullYear() +
            value +
            "-" +
            (month < 10 ? "0" : "") +
            month +
            "-" +
            (now.getDate() < 10 ? "0" : "") +
            now.getDate()
          );
      }
    },
    authority(item) {
      let isshow = "";
      switch (item.orderStatus) {
        case "1":
          isshow = ["event:alarm:judge"];
          break;
        case "2":
          isshow = ["event:alarm:sch"];
          break;
        case "3":
          isshow = ["event:alarm:claim"];
          break;
        case "4":
          isshow = ["event:alarm:dis"];
          break;
        case "5":
          isshow = ["event:alarm:ver"];
          break;
      }
      return isshow;
    },
    getthemeColor(index) {
      let color = $(".el-button--primary").css("background-color");
      return index == this.isShowView ? color : "#ffffff";
    },
    /**
     * 铁塔账号 租户选择
     */
    tenantChange(tenantId) {
      this.qryParams.tenantId = tenantId;
    },
    /**
     * 铁塔账号 关键字查询租户
     */
    searchTenant(query) {
      let params = {
        keyword: query,
      };
      queryTenantInfo(params).then(
        (resp) => {
          if (resp && resp.code == 200) {
            for (let i in resp.data) {
              resp.data[i].tenantName =
                resp.data[i].tenantName + "(" + resp.data[i].tenantId + ")";
            }
            this.tenantList = resp.data;
          } else {
            this.tenantList = [];
          }
        },
        () => {
          this.tenantList = [];
        },
        false
      );
    },
    showInput() {
      this.showInputFlag = !this.showInputFlag;
    },
    changeFun(code) {
      this.qryParams.area = code;
      if (code.length == 3 || code.length == 0) {
        return;
      }
      let _this = this;
      let list = [];
      getRegion({
        areaLevel: code.length == 1 ? 3 : 4,
        areaParentCode: code[code.length - 1],
      }).then((result) => {
        if (result.code === 200) {
          if (code.length == 1) {
            for (let i = 0; i < result.data.length; i++) {
              let item = result.data[i];
              list.push({
                label: item.areaName,
                value: item.areaCode,
                children: [],
              });
            }
            for (
              let i = 0;
              i < _this.selectDataSource.areaOptions.length;
              i++
            ) {
              let row = _this.selectDataSource.areaOptions[i];
              if (row.value == code[0]) {
                _this.selectDataSource.areaOptions[i].children = list;
              }
            }
          } else if (code.length == 2) {
            for (let i = 0; i < result.data.length; i++) {
              let item = result.data[i];
              list.push({
                label: item.areaName,
                value: item.areaCode,
              });
            }
            for (
              let count = 0;
              count < _this.selectDataSource.areaOptions.length;
              count++
            ) {
              for (
                let j = 0;
                j < _this.selectDataSource.areaOptions[count].children.length;
                j++
              ) {
                let row = _this.selectDataSource.areaOptions[count].children[j];
                if (row.value == code[1]) {
                  _this.selectDataSource.areaOptions[count].children[
                    j
                  ].children = list;
                }
              }
            }
          }
        }
      });
    },
    async getDevice(query) {
      let _this = this;
      if (query) {
        let params = {
          devName: query,
          cityId: _this.getCityId(_this.qryParams.area),
          provinceId: _this.getProvinceId(_this.qryParams.area),
          countyId: _this.getCountyId(_this.qryParams.area),
          appVerCode: this.$store.getters.userInfo.chooseAppVerCode,
        };
        let result = await getDeviceList(params);
        if (result.code === 200) {
          _this.selectDataSource.DeviceList = [];
          _this.selectDataSource.DeviceList = result.data;
        }
      } else {
        _this.selectDataSource.DeviceList = [];
      }
    },
    // 物联设备
    async getIotDevice(query) {
      console.log(query);
      let _this = this;
      if (query) {
        let params = { codeOrName: query };
        let result = await getIotDeviceList(params);
        if (result.code === 200) {
          _this.selectDataSource.iotDeviceList = result.data;
        }
      } else {
        _this.selectDataSource.iotDeviceList = [];
      }
    },
    getProvinceId(code) {
      if (code != null && code != "") {
        return code[0];
      }
      return null;
    },
    getCityId(code) {
      if (code != null && code != "" && code != "" && code.length > 1) {
        return code[1];
      }
      return null;
    },
    getCountyId(code) {
      if (code != null && code != "" && code != "" && code.length > 2) {
        return code[2];
      }
      return null;
    },
    clickAll1() {
      //鼠标点击事件
      this.pagintionShowStatus1 = 0;
    },
    searchTenantFun(row) {
      this.qryParams.tenantId = row.tenantId;
      this.qryParams.tenantData = row.tenantName + "/" + row.tenantId;
    },
    getTenantData(isShow) {
      let _this = this;
      let params = {
        pageNum: _this.tenantPageData.currentPage,
        pageSize: _this.tenantPageData.page_size,
        provinceId: _this.getProvinceId(_this.qryParams.area),
        cityId: _this.getCityId(_this.qryParams.area),
        // countyId: _this.getCountyId(_this.qryParams.area),
        keyword: _this.qryParams.tenantData,
      };
      queryTenant(params).then((resp) => {
        if (resp && resp.resultStat == "SUCCESS") {
          _this.tenantData = resp.data.list;
          if (isShow != 1) {
            _this.pagintionShowStatus1 = 1;
          }
          _this.tenantPageData.total = resp.data.total;
        } else {
          $message.warning(resp.mess);
        }
      });
    },
    /**
     * 加载初始化方法
     */
    loadInit() {
      let _this = this;
      this.getEnumInfo(
        {
          enumTypeId: 41,
        },
        (result) => {
          _this.selectDataSource.eventLevelList = result.data;
        }
      );
      this.onLoadData_type();
      this.getEnumInfo(
        {
          enumTypeId: "warning_source_common",
        },
        (result) => {
          _this.selectDataSource.eventSourceList = result.data;
        }
      );
      this.onLoadData_area();
      this.getEnumInfo(
        {
          enumTypeId: 65,
        },
        (result) => {
          _this.selectDataSource.eventStateList = result.data.filter((item) => {
            return item.dictValue != "3";
          });
        }
      );
      this.getEnumInfo(
        {
          enumTypeId: 90,
        },
        (result) => {
          _this.selectDataSource.importanceLevelList = result.data;
        }
      );
      this.getEnumInfo(
        {
          enumTypeId: 102,
        },
        (result) => {
          _this.selectDataSource.noticeResourceList = result.data;
        }
      );
      this.getUserState();
      this.gettype();

      if (_this.$store.getters.userInfo.tenantId) {
        _this.getCustOrganTree(); // 查询组织树
      } else {
        this.orgTreeData = this.$store.getters.userDeptTreeOptions;
        this.orgTreeProp.label = "label";
        this.orgTreeProp.value = "id";
      }
      if (this.$store.getters?.userInfo?.tenantId) {
        this.getLabelList(); //查询设备标签列表
      }
      if (!this.userIdIsShow) {
        this.getAllTags();
      }
    },
    //标签列表
    getLabelList() {
      queryTenantLabelList({
        tenantId: this.$store.getters.userInfo.tenantId,
      }).then((res) => {
        if (res.code === 200) {
          this.$data.selectDataSource.deviceLabelList = res.data;
        } else {
          $message.warning(res.msg);
        }
      });
    },
    getDetails(row) {
      let _this = this;
      let params = {
        orderId: row.orderId,
      };
      getOrderList(params).then((result) => {
        if (result.code === 200) {
          let item = result.data.list[0];
          row.orderStatus = item.orderStatus;
        }
      });
    },
    btnClickFun(row) {
      if (row.ifEdit == "1") {
        if (row.orderStatus == "3") {
          // $v.message({
          //   message: '请到“铁塔视联平台app”认领处理单！',
          //   type: 'error'
          // });
          // return;
        } else if (["1", "2", "4", "5"].includes(row.orderStatus)) {
          sessionStorage.setItem(
            "orderList",
            JSON.stringify(this.viewDataSouse)
          );
          sessionStorage.setItem("orderListTotal", this.pageData.total);
          this.doLinkEdit(row);
        } else {
          let params = {
            appVerCode: row.appVerCode,
            linkId: row.linkId,
            status: 1,
          };
          querySysLinkViewUrl(params).then((res) => {
            if (res.code === 200 && res.data) {
              this.$router.push({
                path: "/" + res.data[0].pcUrl,
                query: {
                  orderId: row.orderId,
                },
              });
            } else {
              $message.warning(res.msg);
            }
          });
        }
      }
    },
    btnNameFun(row) {
      let btnName = "";
      let icon = "";
      if (row.enableAcceptanceMode === "1") {
        return `<span class="iconfont icon-shouli" style="font-size: 14px"></span>  受理`;
      }
      switch (row.orderStatus) {
        case "0":
          btnName = "假警";
          break; //虚假告警完结
        case "1":
          btnName = "研判";
          btnName = `<span class="iconfont icon-yanpan" style="font-size: 14px"></span>  ${btnName}`;
          break;
        case "2":
          btnName = "调度";
          btnName = `<span class="iconfont icon-tiaodu1" style="font-size: 14px"></span>  ${btnName}`;
          break;
        case "3":
          btnName = "待认领";
          break; //"待处置-部门";
        case "4":
          btnName = "处置";
          btnName = `<span class="iconfont icon-chuzhi1" style="font-size: 14px"></span>  ${btnName}`;
          break;
        case "5":
          btnName = "核实";
          btnName = `<span class="iconfont icon-heshi1" style="font-size: 14px"></span>  ${btnName}`;
          break;
        case "6":
          btnName = "工单完成";
          break;
        case "7":
          btnName = "重复告警";
          break; //重复告警完成
        default:
          this.btnName = row.orderStatusName;
          break;
      }
      return btnName;
    },
    expandChangeFun(code) {
      // let _this = this;
      // let val = code[0];
      // let cityList = [];
      // $v.post(_this, urlVideo + '/video/getRegion', {areaLevel: 2, 'areaParentCode': val}, function (result) {
      //   if (result.resultStat === "SUCCESS") {
      //     for (let i = 0; i < result.data.length; i++) {
      //       let item = result.data[i];
      //       cityList.push({
      //         label: item.areaName,
      //         value: item.areaCode
      //       })
      //     }
      //     for (let i = 0; i < _this.selectDataSource.areaOptions.length; i++) {
      //       let row = _this.selectDataSource.areaOptions[i];
      //       if (row.value == val) {
      //         _this.selectDataSource.areaOptions[i].children = cityList;
      //       }
      //     }
      //   }
      // })
    },
    getQueryString(name) {
      //构造一个含有目标参数的正则表达式对象
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
      //匹配目标参数
      var r = window.location.search.substr(1).match(reg);
      if (r != null) {
        return unescape(r[2]);
      } else {
        //返回参数值
        return "";
      }
    },
    gettype() {
      let url = location + "";
      if (url.indexOf("?") !== -1) {
        this.type = $getUrlParam("type");
        switch (this.type) {
          case "2":
            this.qryParams.eventState = "1";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "3":
            this.qryParams.eventState = "2";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "4":
            this.qryParams.eventState = "4";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
          case "5":
            this.qryParams.eventState = "5";
            this.qryParams.eventWait = "1";
            this.qryParams.warnTime = null;
            break;
        }
      }
    },
    getUserState() {
      // let user = $store.get('$loginInfo');
      let user = this.$store.getters.userInfo;
      if (user.tenantId) {
        this.custIsShow = true;
      }
      // 铁塔视角 0，租户视角2
      this.userIdIsShow = user.userType !== "2";
      this.searchAlarmCause(); // 查询告警原因
    },
    timeStr(str) {
      return DateFormat.utcTimeToStrTime(str + "");
    },

    onLoadData_type() {
      let _this = this;
      findOrderAlarm({}).then((result) => {
        if (result.code === 200) {
          _this.selectDataSource.eventTypeList = result.data;
        }
      });
    },
    onLoadData_area() {
      let _this = this;
      _this.selectDataSource.areaOptions = [];
      _this.onLoadData_province();
    },
    onLoadData_province() {
      let _this = this;
      getRegion({
        areaLevel: 2,
      }).then((result) => {
        if (result.code === 200) {
          for (let i = 0; i < result.data.length; i++) {
            let row = result.data[i];
            _this.selectDataSource.areaOptions.push({
              label: row.areaName,
              value: row.areaCode,
              children: [],
            });
          }
          const pd = $getUrlParam("pd");
          const cd = $getUrlParam("cd");
          const cyd = $getUrlParam("cyd");
          // this.qryParams.area = [pd, cd, cyd];
          // console.log(this.qryParams.area, 66);
          // const areaT = [];
          // if (pd) {
          //   areaT.push(pd);
          //   console.log(areaT, "pd");
          //   this.changeFun(areaT);
          // }
          // if (cd) {
          //   areaT.push(cd);
          //   console.log(areaT, "cd");

          //   this.changeFun(areaT);
          // }
          // if (cyd) {
          //   areaT.push(cyd);
          //   this.changeFun(areaT);
          // }
          const area = [];
          if (pd) {
            area.push(pd);
          }
          if (cd) {
            area.push(cd);
          }
          if (cyd) {
            area.push(cyd);
          }
          this.qryParams.area = area;
          // this.qryParams.area = ["140000", "140400", "140406"];
          this.changeFun([pd]);
          if (cd) {
            this.changeFun([pd, cd]);
          }
          if (cyd) {
            this.changeFun([pd, cd, cyd]);
          }
          // this.changeFun(["140000", "140400", "140406"]);
          this.getViewDataSource();
        } else {
          this.getViewDataSource();
        }
      });
    },
    getEnumInfo(params, success) {
      let _this = this;
      getEnumInfo(params).then((resp) => {
        if (resp.code === 200) {
          if (success) {
            success(resp);
          }
        }
      });
    },
    /**
     * params添加参数,空字符串不添加
     * @param params
     * @param value 字段值
     * @param nullValue 字段空时的默认值
     * @param name 字段
     */
    addParam(params, name, value, nullValue) {
      if (value !== "" && value != null) {
        params[name] = value;
      } else {
        if (nullValue) {
          params[name] = nullValue;
        }
      }
    },
    getViewDataSource(isSelectorReset) {
      if (this.tableLoad) {
        return;
      }
      this.tableLoad = true;
      let _this = this;
      // let $loginInfo = $store.get('$loginInfo');

      this.viewDataSouse = [];
      let params = this.getSearchParams();
      this.searchParams = params;
      getOrderList(params)
        .then((result) => {
          this.tableLoad = false;
          if (result.code === 200) {
            if (this.pageData.currentPage > 1 && result.rows.length === 0) {
              this.pageData.currentPage = this.pageData.currentPage - 1;
              this.getViewDataSource();
            }
            _this.pageData.total = result.total;
            _this.viewDataSouse = result.rows;
            _this.listData = result.rows?.map(({ orderStatus, orderId }) => ({
              orderStatus,
              orderId,
            }));
            if (isSelectorReset) {
              this.resetSelect();
            }
            this.prevSearch.params = JSON.parse(JSON.stringify(params));
            this.prevSearch.total = result.total;
            if (this.isShowView == 2) {
              this.handleCheckData();
            }
          }
        })
        .catch((e) => {
          this.tableLoad = false;
        });
    },
    queryEventData() {
      if (!this.checkConfidenceLevel()) {
        $message.error(
          "“最小值、最大值”需至少填写一项，且最小值需要小于等于最大值"
        );
        return;
      }
      this.selectDataSource.DeviceList = [];
      this.pageData = {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      };
      this.getViewDataSource(true);
    },
    resetData() {
      this.qryParams = {
        tagIdList: [],
        eventTitle: "", //事件标题
        area: "", //所属区域
        warnTime: "", //告警时间
        eventType: [], //告警类型
        eventSourse: "", //告警来源
        eventLevel: "", //事件等级
        eventState: "", //事件状态
        deviceCode: "",
        deviceCode2: "",
        importanceLevel: "", //重要等级
        judgeResult: "", //研判结果
        isCollection: "", //是否收藏
        enlargeFlag: "", //是否3D放大
        orgIds: [], // 组织名称
        areaIds: [],
        areaCodeList: [],
        deviceLabelId: [], //设备标签id
        sortName: "",
        sort: "",
        secondJudgeResult: "",
        isSecondJudge: "",
        confidenceLevelMin: "", // 置信度最小值
        minChar: "100", // 置信度左边符号
        confidenceLevelMax: "",
        maxChar: "100",
        alarmTagIdsList: [],
        alarmReasonList: [],
      };
      if (this.tab === "2") {
        this.qryParams.ifTimeOut = "1";
        this.qryParams.eventState = this.selectDataSource.eventStateList
          .filter((item) => item.dictValue !== "6")
          .map((item) => item.dictValue);
      }

      if (this.isMyEvent && this.eventWait) {
        this.qryParams.eventWait = this.eventWait;
      }
      this.selectDataSource.DeviceList = [];
      this.tenantkeyword = "";
      this.pageData = {
        total: 0,
        page_sizes: [6, 18, 36, 54],
        currentPage: 1,
        page_size: 6,
      };
      if (this.$refs.at) {
        this.$refs.at.columnConfig.order = "";
      }
      if (this.$refs.rt) {
        this.$refs.rt.columnConfig.order = "";
      }
      if (this.$refs.checkTable) {
        this.$refs.checkTable.clearSort();
      }

      this.tenantList = [];
      this.getSixMonths();
      this.getViewDataSource();
      this.resetSelect();
    },
    clearDev(b) {
      if (b === false) {
        this.selectDataSource.DeviceList = [];
      }
    },
    // clearDev2(){
    //   let _this=this;
    //   if(!_this.qryParams.deviceCode2){
    //     console.log("+++++++++++"+_this.qryParams.deviceCode2)
    //     _this.selectDataSource.DeviceList=[];
    //     }
    // },
    // 归属组织树
    getCustOrganTree() {
      getCustOrganTreeNew({
        orgSource: "1",
        orgType: "1",
        tenantId: this.$store.getters.userInfo.tenantId,
      }).then((res) => {
        if (res.code === 200) {
          this.$data.orgTreeData = res.data;
          // this.$data.orgTreeData = this.transformTreeData(res.data);
        } else {
          $message.warning(res.msg);
        }
      });
    },
    transformTreeData(treeData) {
      if (treeData.length) {
        let cloneData = JSON.parse(JSON.stringify(treeData)).filter((item) => {
          return item.orgType != "2";
        }); // 对源数据深度克隆
        return cloneData.filter((father) => {
          let branchArr = cloneData.filter(
            (child) => father.orgId == child.parentOrgId
          ); //返回每一项的子级数组
          if (branchArr.length > 0) {
            //如果存在子级，则给父级添加一个children属性，并赋值
            father.children = branchArr;
          }
          return father.orgLevel == "1"; //返回第一层
        });
      }
      return [];
    },
    viewClick(val) {
      switch (val) {
        case 1:
          this.isShowView = 1;
          this.$nextTick(() => {
            for (let i = 0; i < this.viewDataSouse.length; i++) {
              this.$refs.viewRefs[i].autoHeight();
            }
          });
          this.getTreeType().then(() => {
            this.doChangeTreeType();
          });
          break;
        case 2:
          this.isShowView = 2;
          this.getTreeType().then(() => {
            this.doChangeTreeType();
          });
          this.handleCheckData();
          break;
        case 3:
          // this.$router.push({
          //   path: "/eventManagementAdd",
          //   query: { pageType: this.isMyEvent },
          // });
          // $v.jumpMenuKeep(this, '/eventManagementAdd', true);
          this.openAdd();
          break;
        case 4:
          this.isShowView = 4;
          break;
      }
    },
    handleCheckData() {
      let tableData = this.viewDataSouse; // 从后台获取到的数据
      this.$nextTick(() => {
        tableData.forEach((item) => {
          const index = this.selectList.findIndex(
            (itemList) => itemList.orderId == item.orderId
          );
          if (index >= 0) {
            this.$refs.checkTable &&
              this.$refs.checkTable.toggleRowSelection(item, true);
          } else {
            this.$refs.checkTable &&
              this.$refs.checkTable.toggleRowSelection(item, false);
          }
        });
      });
    },
    operationType(val) {
      switch (val) {
        case 5:
          return "批量研判";
        case 6:
          return "关闭";
        case 7:
          return "删除";
        case 8:
          return "重置";
      }
    },
    viewClick2(val) {
      if (val != 8) {
        if (this.selectList.length > 100) {
          $message.warning(`最多可选100个告警事件。`);
          return;
        }
        if (this.selectList.length <= 0) {
          $message.warning(
            `请选择告警事件后，再进行` + this.operationType(val) + `处理！`
          );
          return;
        }
      }
      switch (val) {
        case 5:
          let status = 0;
          let moreNextStatus = 0;
          let ifEdit = 0;
          let accept = 0;
          this.selectList.forEach((item) => {
            if (item.orderStatus != "1") {
              status++;
            } else {
              if (item.moreNextFlag == "1") {
                moreNextStatus++;
              }
              if (item.ifEdit == 0) {
                ifEdit++;
              }
              if (item.enableAcceptanceMode === "1") {
                // 开启了受理状态
                accept++;
              }
            }
          });
          if (
            status === 0 &&
            moreNextStatus === 0 &&
            ifEdit === 0 &&
            accept === 0
          ) {
            this.isbatchJudge = true;
          }
          if (moreNextStatus !== 0) {
            $message.warning(
              "您选择的事件中存在研判环节下连接多个环节的事件无法进行研判操作，请取消后重试。"
            );
          }
          if (status !== 0) {
            setTimeout(() => {
              $message.warning(
                "您选择的事件中存在不是待研判环节的事件，无法进行研判操作，请取消后重试。"
              );
            });
          }
          if (ifEdit !== 0) {
            setTimeout(() => {
              $message.warning(
                "您选择的事件中存在没有该事件的处理权限，无法进行研判操作，请取消后重试。"
              );
            }, 100);
          }
          if (accept !== 0) {
            setTimeout(() => {
              $message.warning(
                "您选择的事件中存在已开启受理的事件，无法进行研判操作，请取消后重试。"
              );
            }, 150);
          }
          break;
        case 6:
          this.isbatchJudge = false;
          let params = {
            warningOrderList: [],
            tenantId: this.$store.getters.userInfo.tenantId,
            closeRemark: this.closeRemark,
          };
          // let closedNum = 0;
          // this.selectList.forEach((item)=>{
          //   if(item.realLinkType == "6" || item.realLinkType == "0" || item.realLinkType == "7") {
          //     closedNum++;
          //   }
          // })
          // if(closedNum !== 0) {
          //   this.$message.warning("您选择的事件中存在已经关闭的事件，无法进行关闭操作，请取消后重试。")
          //   return;
          // }
          this.selectList.forEach((item) => {
            params.warningOrderList.push({
              warningOrderId: item.orderId,
              currentLink: item.linkId,
            });
          });
          // this.$confirm("是否需要将选中的告警事件进行关闭？", {
          //   distinguishCancelAndClose: true,
          //   confirmButtonText: "确定",
          //   cancelButtonText: "取消",
          //   type: "warning",
          //   showClose: false,
          // }).then(() =>
          //   batchEndWarningOrder(params).then((res) => {
          //     if (res.code === 200) {
          //       this.$message.success("批量关闭成功");
          //       this.selectList = [];
          //       this.loadInit();
          //     } else {
          //       this.$message.warning(res.msg);
          //     }
          //   })
          // );
          batchEndWarningOrder(params).then((res) => {
            if (res.code === 200) {
              $message.success("批量关闭成功");
              this.selectList = [];
              this.loadInit();
            } else {
              $message.warning(res.msg);
            }
          });
          this.closeRemarkVisible = false;
          this.closeRemark = "";
          break;
        case 7:
          this.isbatchJudge = false;
          let params7 = {
            warningOrderIdList: [],
            tenantId: this.$store.getters.userInfo.tenantId,
            deleteRemark: this.deleteRemark,
          };
          this.selectList.forEach((item) => {
            params7.warningOrderIdList.push(item.orderId);
          });
          batchDelWarningOrder(params7).then((res) => {
            if (res.code == 200) {
              $message.success("批量删除成功");
              this.selectList = [];
              this.loadInit();
            } else {
              $message.warning(res.msg);
            }
          });
          this.deleteRemarkVisible = false;
          this.deleteRemark = "";
          break;
        case 8:
          this.selectList = [];
          if (this.isShowView == 2) {
            this.handleCheckData();
          }
          break;
      }
    },
    // 批量关闭对话框新增
    batchDelete(val) {
      if (val != 8) {
        if (this.selectList.length > 100) {
          $message.warning(`最多可选100个告警事件。`);
          return;
        }
        if (this.selectList.length <= 0) {
          $message.warning(
            `请选择告警事件后，再进行` + this.operationType(val) + `处理！`
          );
          return;
        }
      }
      let closedNum = 0;
      this.selectList.forEach((item) => {
        if (
          item.realLinkType == "6" ||
          item.realLinkType == "0" ||
          item.realLinkType == "7"
        ) {
          closedNum++;
        }
      });
      if (closedNum !== 0) {
        $message.warning(
          "您选择的事件中存在已经关闭的事件，无法进行关闭操作，请取消后重试。"
        );
        return;
      }
      this.closeRemarkVisible = true;
    },
    clearCloseRemark() {
      this.closeRemarkVisible = false;
      this.closeRemark = "";
    },
    deleteOut(val) {
      if (val != 8) {
        if (this.selectList.length > 100) {
          $message.warning(`最多可选100个告警事件。`);
          return;
        }
        if (this.selectList.length <= 0) {
          $message.warning(
            `请选择告警事件后，再进行` + this.operationType(val) + `处理！`
          );
          return;
        }
      }
      this.deleteRemarkVisible = true;
    },
    clearDeleteRemark() {
      this.deleteRemarkVisible = false;
      this.deleteRemark = "";
    },
    selectWarn(data) {
      const index = this.selectList.findIndex(
        (item) => item.orderId == data.orderId
      );
      if (index < 0) {
        this.selectList.push(data);
      } else {
        this.selectList.splice(index, 1);
      }
      if (this.selectList.length > 10) {
        $message.warning(`当前已选择` + this.selectList.length + `条。`);
      }
    },
    tenantHandleSizeChange(val) {
      this.tenantPageData.page_size = val;
      this.getTenantData();
    },
    tenantHandleCurrentChange(val) {
      this.tenantPageData.currentPage = val;
      this.getTenantData();
    },
    handleSizeChange(val) {
      this.pageData.page_size = val;
      this.getViewDataSource();
    },
    handleCurrentChange(val) {
      this.pageData.currentPage = val;
      this.getViewDataSource();
    },
    //表头样式
    headerCellStyle({ row, column, rowIndex, columnIndex }) {
      return (
        "background: #F8F8F8;\n" +
        "border-radius: 5px 0px 0px 0px;\n" +
        "border: 1px solid #EEEEEE;\n" +
        "font-size: 14px;\n" +
        "font-family: PingFangSC-Regular, PingFang SC;\n" +
        "font-weight: 400;\n" +
        "color: #333333;\n" +
        "height: 40px;"
      );
    },
    query(row) {
      sessionStorage.setItem("orderList", JSON.stringify(this.viewDataSouse));
      sessionStorage.setItem("orderListTotal", this.pageData.total);
      this.$linkto("/eventLinks", {
        orderId: row.orderId,
        orderStatus: row.orderStatus,
        pageType: this.isMyEvent,
        searchParams: JSON.stringify(this.searchParams),
        fromPageType: this.isMyEvent ? "myEvent" : "eventManagement",
        isDetail: "1",
      });
    },
    verifyConfidenceLevel(input, property) {
      var reg = /^(0\.\d+|0|1)$/;
      if (reg.test(input)) {
        this.qryParams[property] = input;
      } else {
        if (input != "0.") {
          this.qryParams[property] = "";
        }
      }
    },
    tabUnfold(e) {
      this.$refs[e].toggleDropDownVisible();
    },
    channelInputLimit(e) {
      let key = e.key;
      // 不允许输入'e'和'.'
      if (key === "e" || key === "-") {
        e.returnValue = false;
        return false;
      }
      return true;
    },
    doLinkEdit(row) {
      let params = {
        orderId: row.orderId,
        linkId: row.linkId,
        realLinkType: row.realLinkType,
      };
      if (row.enableAcceptanceMode === "1") {
        params.enableAcceptanceMode = "1";
      }
      getCurrentByOrderIdAndLinkId(params).then((res) => {
        if (res.code == 200) {
          if (res.data.ifCurrentLink == "1") {
            // 研判、调度、处置、核实、详情
            this.$linkto("/eventLinks", {
              orderId: row.orderId,
              orderStatus: row.orderStatus,
              pageType: this.isMyEvent,
              searchParams: JSON.stringify(this.searchParams),
              fromPageType: this.isMyEvent ? "myEvent" : "eventManagement",
            });
          } else {
            $message.warning("该事件环节已处理完成，请刷新列表");
          }
        } else {
          $message.error("服务器错误");
        }
      });
    },
    //  获取今天到前7天
    getSixMonths(n = 1) {
      const [minTime, date] = this.getTimestampsForPastXDays(7);
      let currentTime = `${date.getFullYear()}-${
        date.getMonth() + 1
      }-${date.getDate()} 23:59:59`;
      let onceTime = `${minTime.getFullYear()}-${
        minTime.getMonth() + 1
      }-${minTime.getDate()} 00:00:00`;
      let defaultTime = [onceTime, currentTime];
      this.qryParams.warnTime = defaultTime;
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    },
    // 置信度输入校验
    checkConfidenceLevel() {
      if (
        this.qryParams.confidenceLevelMin != "" &&
        this.qryParams.confidenceLevelMin == this.qryParams.confidenceLevelMax
      ) {
        this.qryParams.minChar = "101";
        this.qryParams.maxChar = "101";
        return true;
      }
      if (
        this.qryParams.confidenceLevelMin != "" &&
        this.qryParams.confidenceLevelMax != "" &&
        Number(this.qryParams.confidenceLevelMin) >
          Number(this.qryParams.confidenceLevelMax)
      ) {
        return false;
      }
      return true;
    },
    changeSecondJudgeResult() {
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    },
    /**
     * 下载告警图片
     */
    downAlarmImg() {
      if (
        this.selectList.length > 50 ||
        (!this.selectList.length && this.prevSearch.total > 50)
      ) {
        return $message.warning("最多可选50个告警事件。");
      }
      if (!this.selectList.length && !this.prevSearch.total) {
        return $message.warning("请选择告警事件。");
      }
      let params = {};
      if (!this.selectList.length) {
        // 根据查询条件导出
        params.downLoadType = "1";
      } else {
        // 根据选中的告警事件导出
        params.downLoadType = "0";
      }
      params.orderIdDownLoadType = "1"; // 其他事件下载查询工单表，标识为1
      params.downLoadOrderDTO = this.prevSearch.params;
      params.warningOrderIds = this.selectList.map((item) => item.orderId);
      let fileName = "告警图片下载";
      let url = "";
      if (this.$store.getters.userInfo.tenantId) {
        url = "/export/alarm/order/downloadImgs";
      } else {
        url = "/export/alarm/order/downLoadImgsTower";
        params.name = "中国铁塔"; // 铁塔视角固定值
      }
      this.imgLoading = true;
      downLoadZipPost(url, fileName, params, this.dowImgsCallback);
    },
    dowImgsCallback(flag) {
      this.imgLoading = false;
      if (flag) {
        $message.success("下载告警图片成功");
      } else {
        $message.error("下载告警图片失败");
      }
    },
    /**
     * 打开自定义列弹窗
     */
    handleColumn() {
      this.sortListData.dialogVisible = true;
    },
    /**
     * 表格重新布局
     */
    doLayout() {
      this.$nextTick(() => {
        this.$refs.checkTable.doLayout();
        this.$refs.checkTable.$forceUpdate();
        this.sortListData.dialogVisible = false;
      });
    },
    /**
     * 自定义列预操作
     */
    getCustomList() {
      if (this.$store.getters.userInfo.userType !== "2") {
        this.columns = [...this.towerColumns, ...this.columns];
      }
      this.defaultList = JSON.parse(JSON.stringify(this.columns));
      if (this.isMyEvent && this.eventWait === "1") {
        this.sortListData.memoryType = "4"; // 我的待办
      }
      if (this.isMyEvent && this.eventWait === "2") {
        this.sortListData.memoryType = "5"; // 我的已办
      }
      let params = {
        memoryType: "",
        userId: this.$store.getters.userInfo.userId,
      };
      getUserMemoryOperate(params).then((res) => {
        if (res.code == 200 && res.data.length > 0) {
          let customItem = {};
          res.data.map((item) => {
            customItem[item.memoryType] = item.memoryTable;
          });
          if (customItem[this.sortListData.memoryType]) {
            this.columns = JSON.parse(customItem[this.sortListData.memoryType]);
          }
        }
      });
    },
    disableContextmenu() {
      return false;
    },
    async handleLyParams(query) {
      if (query.deviceName) {
        await this.getDevice(query.deviceName);
        this.qryParams.deviceCode2 =
          this.selectDataSource.DeviceList[0]?.deviceCode;
      } else if (query.iotName) {
        await this.getIotDevice(query.iotName);
        this.qryParams.iotDeviceCode2 =
          this.selectDataSource.iotDeviceList[0]?.deviceCode;
      }
      this.qryParams = JSON.parse(JSON.stringify(this.qryParams));
    },
    // 查询告警原因列表
    searchAlarmCause() {
      if (!this.userIdIsShow) {
        queryAlarmReasonList({}).then((res) => {
          if (res.code === 200) {
            this.alarmCauseList = res.data;
          }
        });
      }
    },
    /**
     * 获取过去X天的日期和时间戳
     * @param days 天数
     * @returns {number[]}
     */
    getTimestampsForPastXDays(days = 0) {
      const day = days === 0 ? 0 : days - 1;
      // 获取今天的日期和时间
      let today = new Date();
      // 设置今天的时间为23:59:59
      today.setHours(23, 59, 59, 0);

      // 创建一个新的Date对象，设置为X天前的日期
      const pastDay = new Date(today);
      pastDay.setDate(today.getDate() - day); // 这里减一是兼容业务
      // 设置时间为00:00:00
      pastDay.setHours(0, 0, 0, 0);

      return [pastDay, today];
    },
    // 切换页签
    tabHandleClick() {
      let warnTimeCopy = this.qryParams.warnTime;
      this.qryParams = {
        tagIdList: [],
        eventTitle: "", //事件标题
        area: "", //所属区域
        warnTime: "", //告警时间
        eventType: [], //告警类型
        eventSourse: "", //告警来源
        eventLevel: "", //事件等级
        eventState: "", //事件状态
        deviceCode: "",
        deviceCode2: "",
        importanceLevel: "", //重要等级
        judgeResult: "", //研判结果
        isCollection: "", //是否收藏
        enlargeFlag: "", //是否3D放大
        orgIds: [], // 组织名称
        areaIds: [],
        areaCodeList: [],
        deviceLabelId: [], //设备标签id
        sortName: "",
        sort: "",
        secondJudgeResult: "",
        isSecondJudge: "",
        confidenceLevelMin: "", // 置信度最小值
        minChar: "100", // 置信度左边符号
        confidenceLevelMax: "",
        maxChar: "100",
        alarmTagIdsList: [],
        alarmReasonList: [],
      };
      this.qryParams.warnTime = warnTimeCopy;
      this.tenantkeyword = "";
      if (this.tab === "1") {
        this.$set(this.qryParams, "ifTimeOut", "");
        this.$set(this.qryParams, "eventState", "");
      } else {
        this.qryParams.ifTimeOut = "1";
        this.qryParams.eventState = this.selectDataSource.eventStateList
          .filter((item) => item.dictValue !== "6")
          .map((item) => item.dictValue);
      }
      this.queryEventData();
    },
  },
};
</script>
<style lang="scss">
.el-tooltip__popper.myEventListTooltip.is-light {
  background: transparent;
  border: none;
}
</style>
<style lang="scss" scoped>
$theme: var(--theme);
.app-container {
  width: 100%;
  overflow: hidden;
}
.table-img-tooltip {
  margin: -20px 0 -30px 300px;
  width: 500px;
  height: 282px;
  box-shadow: 0px 2px 12px 0px rgba(0, 0, 0, 0.06);
  border-radius: 2px;
  .image-slot,
  img {
    width: 100%;
    height: 100%;
  }
}

.table-img {
  width: 60px;
  height: 38px;
  border-radius: 2px;
}

/deep/ #alarmTime .el-form-item__content {
  line-height: 30px !important;
}

.eventTopRow {
  margin: 0 0 0 0;
}

/deep/ .eventMidRow {
  margin: 0px 0px 0px 0px !important;
  text-align: center !important;
  .el-button {
    border-radius: 4px;
  }
}

/deep/ .tableSpan span {
  color: #ffffff;
}

/*搜索*/
#searchid1 /deep/ .el-input__inner {
  display: inline !important;
  width: 100% !important;
  height: 40px;
  line-height: 40px;
}

#searchid1 /deep/ .search {
  width: 100% !important;
  height: 40px;
  line-height: 40px;
}

#searchid1 .search span {
  height: 40px;
  line-height: 40px;
}

#searchid1 /deep/ .el-input__icon {
  line-height: 40px;
}

#searchid1 .el-pagination {
  margin: 0px;
}

#searchid1 .homeSearch {
  width: 100%;
  height: 40px;
  float: right;
  margin-right: 38px;
  position: relative;
  border-radius: 4px;
}

// #searchid1 .spanStyle {
//   white-space: nowrap; /*强制span不换行*/
//   display: inline-block; /*将span当做块级元素对待*/
//   width: 100%; /*限制宽度*/
//   overflow: hidden; /*超出宽度部分隐藏*/
//   text-overflow: ellipsis; /*超出部分以点号代替*/
// }

#searchid1 .el-pagination {
  background: #ffffff;
  margin: 0;
}

.tableStyle {
  padding: 0 10px;
  //min-height: 450px;
}

/deep/ #findtenantId .el-input__inner,
#alarmTime .el-input__inner {
  height: 32px !important;
  line-height: 40px;
}

.eventSelectClass {
  background: $theme;
  color: #ffffff;
  float: right;
}

.eventUnSelectClass {
  background: #ffffff;
  color: #2c2f33;
  float: right;
}

#showButtonId {
  display: block;
  width: 2em;
  height: 5em;
  text-align: center;
  white-space: normal;
  padding: 0 !important;
  position: absolute;
  right: -0.8em;
  top: 2em;
  box-shadow: none !important;
  border: 1px white solid !important;
}

/deep/ .el-input {
  font-size: 14px !important;
}

.custom-hr {
  margin: 12px 0px;
  background-color: #f0f0f0;
  border: none;
  height: 1px;
}

.showView,
.showList,
.showAdd,
.showOther {
  padding: 0 12px;
  box-sizing: content-box;
  height: 33px;
  line-height: 35px;
  margin-left: 10px;
}

.showView {
  padding: 0 6px;
  width: 21px;
}

/deep/ .el-button.el-button--small {
  height: 32px;
  padding: 0 11px;
}

/deep/ .el-table--small td {
  padding: 0;
  height: 45px;
}

/deep/ .el-table--small th {
  padding: 0;
  height: 40px;
}

/deep/ .el-cascader__tags {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;

  .el-tag.el-tag--info {
    max-width: 51%;
  }
}

/deep/.no-tips input::-webkit-outer-spin-button,
/deep/.no-tips input::-webkit-inner-spin-button {
  -webkit-appearance: none !important;
}

/deep/.no-tips input[type="number"] {
  -moz-appearance: textfield !important;
}

/deep/.el-table .ascending .sort-caret.ascending {
  border-bottom-color: $theme !important;
}

/deep/.el-table .descending .sort-caret.descending {
  border-top-color: $theme !important;
}

/deep/.el-button + .el-button {
  margin-left: 0px;
}
/deep/ .el-form .el-form-item .el-form-item__content {
  padding: 0 0 0 12px;
}
/deep/ .el-form .el-form-item.el-form-item--small {
  margin-bottom: 12px !important;
}
/deep/ .el-select input::placeholder {
  color: #909399 !important;
  font-size: 14px;
}
/deep/ .el-input input::placeholder {
  color: #909399 !important;
  font-size: 14px;
}
/deep/.el-cascader__search-input::placeholder {
  color: #909399 !important;
  font-size: 14px;
}
/deep/.el-date-editor .el-range-separator {
  height: 28px !important;
  display: block;
}
/deep/.clear-icon .el-range__close-icon {
  display: none;
}
.confidenceLevel /deep/ .el-icon-arrow-up:before {
  content: "\e78f";
}
.input-wrapper {
  width: 100%;
  height: 32px;
  display: flex;
  flex-wrap: nowrap;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  position: relative;
  .tips {
    position: absolute;
    left: 0;
    top: 32px;
    font-size: 12px;
    color: #ff6a6c;
    height: 12px;
    line-height: 1;
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
}
.bor /deep/.el-input__inner {
  border: none;
  height: 100%;
  padding: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  font-size: 14px;
  text-align: center;
  padding-left: unset !important;
}
.bor /deep/ .el-select .el-input__inner {
  text-align: right;
}
.bor {
  flex: 1;
  border-right: 1px solid #dcdfe6;
  display: flex;
  justify-content: center;
  /deep/.el-input--small {
    height: 30px;
    line-height: 30px;
  }
  /deep/.el-select--small {
    height: 30px;
    line-height: 30px;
    max-width: 60px;
  }
  /deep/.el-input__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #909399;
  }
}
.confidenceLevel .bor-none {
  border: none;
}
.bor /deep/.el-select .el-input input {
  font-size: 16px;
  height: 28px;
  line-height: 28px;
}
.center-text {
  white-space: nowrap;
  background-color: #f4f4f5;
  color: rgba(51, 51, 51, 0.65);
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  font-size: 14px;
}
/deep/.el-table .el-table__row .el-button--text {
  padding: 0;
  background: transparent !important;
  color: #409ffe !important;
}
/deep/.tableStyle .el-table .cell {
  padding-left: 14px;
}
/deep/.el-table .el-table__header-wrapper .cell {
  padding-left: 10px !important;
}
/deep/.el-table__header tr {
  padding: 0;
  height: 40px;
}
/deep/.el-table__fixed-header-wrapper th .cell {
  height: 40px;
  line-height: 40px;
}
/deep/ .el-select .el-input .el-select__caret {
  color: #909399;
}
.zhixindu-select /deep/ .el-select .el-input .el-select__caret {
  color: #c0c4cc;
}
/deep/ .el-cascader .el-input .el-icon-arrow-down {
  color: #909399;
}

.el-button {
  border-radius: 4px;
}
.img-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  .table-img {
    .image-slot,
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.img-wrapper .el-image + .el-image {
  margin-left: 10px;
}
.dialogInput {
  /deep/.el-dialog > .el-dialog__header {
    padding: 12px;
  }
  /deep/.el-dialog > .el-dialog__body {
    padding: 12px 60px 0;
  }
  /deep/.el-textarea__inner {
    height: 60px;
    width: 360px;
  }
  /deep/.el-form .el-form-item.el-form-item--small {
    margin-bottom: 0;
  }

  /deep/.el-dialog {
    border-radius: 4px;
  }
  /deep/ .el-dialog > .el-dialog__footer {
    padding: 12px;
  }
  /deep/ .el-textarea__inner {
    padding: 6px 12px;
  }
}
/deep/.el-table__row td:last-child .cell {
  max-width: 100px !important;
}
.my-already /deep/.el-table__row td:last-child .cell {
  max-width: unset !important;
}
/deep/.el-table__body .cell .el-checkbox {
  padding-right: 2px;
}
/deep/.el-select-dropdown {
  width: 100%;
}
/deep/ .el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  background: #fff0f0;
}
/deep/ .el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
  background: #fff0f0;
}
/deep/ input:focus {
  border-color: #a9a9a9; /* 修改为你想要的颜色 */
}
/deep/ .el-select input:hover,
.el-select input:focus {
  border-color: #a9a9a9; /* 修改为你想要的颜色 */
}
/deep/ .el-select__input.is-focus {
  border-color: #a9a9a9; /* 修改为你想要的颜色 */
}
/deep/ .el-select .el-input.is-focus .el-input__inner {
  border-color: #a9a9a9;
}

.el-button {
  border-radius: 4px;
}
/deep/.el-input__inner {
  padding-left: 12px;
}
/deep/.el-select .el-input.is-focus .el-input__inner,
/deep/.el-cascader .el-input .el-input__inner:focus,
/deep/.el-cascader .el-input.is-focus .el-input__inner,
/deep/.el-range-editor.is-active,
/deep/.el-range-editor.is-active:hover {
  border-color: #a9a9a9;
}
.span_top {
  color: #909399;
  line-height: 12px;
  display: flex;
  margin-top: 12px;
}
.text-style {
  margin-left: 0px;
  font-weight: 500;
  font-family: PingFangSC, PingFang SC;
}
.select-manage13 {
  /deep/ .el-select__input {
    margin-left: 13px;
  }
  /deep/ .el-cascader__search-input {
    margin-left: 13px;
  }
}
/deep/ .el-tabs {
  .el-tabs__item {
    font-family: PingFangSC, PingFang SC;
    padding: 0 12px;
    font-size: 16px;
    line-height: 48px;
    height: 48px;
  }
  .el-tabs__item.is-active {
    font-weight: 500;
  }
  .el-tabs__header {
    .el-tabs__nav-wrap {
      &::after {
        height: 1px;
      }
    }
  }
}
</style>

<style lang="scss" scoped src="./index.scss"></style>
<style lang="scss" scoped>
@import "@/assets/styles/common/customBaseUi.scss";
</style>
<style lang="scss">
.warnTime {
  .el-date-range-picker__time-header {
    .el-date-range-picker__editors-wrap
      .el-date-range-picker__time-picker-wrap:nth-child(1) {
      z-index: -1;
    }
  }
}
</style>
